package com.abaaba.project2.bean;

import lombok.Data;

import java.util.Date;

@Data
public class Keyword {
    private static Integer index;
    private Integer id;

    private String keyword;

    private String url;

    private Boolean isHot;

    private Boolean isDefault;

    private Integer sortOrder;

    private String addTime;

    private String updateTime;

    private Boolean deleted;

    public Keyword() {
    }

    public Keyword(Integer id, String keyword, String url, Boolean isHot, Boolean isDefault, Integer sortOrder, String addTime, String updateTime, Boolean deleted) {
        this.id = id;
        this.keyword = keyword;
        this.url = url;
        this.isHot = isHot;
        this.isDefault = isDefault;
        this.sortOrder = sortOrder;
        this.addTime = addTime;
        this.updateTime = updateTime;
        this.deleted = deleted;
    }

    public void setAddTime(String addTime) {
        index = addTime.lastIndexOf(".");
        if (index != -1) {
            this.addTime = addTime.substring(0, index);
        }else {
            this.addTime = addTime;
        }
    }

    public void setUpdateTime(String updateTime) {
        index = updateTime.lastIndexOf(".");
        if (index != -1) {
            this.updateTime = updateTime.substring(0, index);
        }else {
            this.updateTime = updateTime;
        }
    }
}